#ifndef API_H
#define API_H
#include <string>
#include <iostream>
#include <errno.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/types.h>
#include <cstdio>
#include <cstdlib>


#include "helpers.h"
#include "accesgate.h"
#include "command.h"
#include "recdes.h"
#include "settings.h"
#include "Exception.h"



class ApiLinda
{
private:
	DesMenager *descManager;
	int			fd;
	int			fk;
	int			lastPrecededTupleAdress;
	std::string schemaNameDESC;
	std::string schemaNameDB;

	int 	openFileDesc();
	void 	closeFileDesc();

	void 	lockSem();
	void 	unlockSem();
	void 	setSemVal(int semVal);
	int 	getSemVal();

 	Record* searchLinda(string format);
public:
				ApiLinda(string schemaName, int size);
				~ApiLinda();
	Record* 	readLinda(string format);
	Record* 	inputLinda(string format);
	void 		outputLinda(string format);
	int 		initializeSemaphores();
	void		pisz();
};



#endif
 

